package com.hsgene.product.domain;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.hsgene.common.util.date.TimeJsonDeserializer;
import com.hsgene.common.util.qiniu.QiniuResourceSerializer;
import com.hsgene.common.util.validation.FieldChecker;
import com.hsgene.sample.dto.GeneticTestingAgencySampleDto;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 基因产品详情
 */
public class GeneticTestingProductDetail {
    private String id;
    /**
     * 机构id
     */
    private String agencyId;
    /**
     * 机构名称，（数据库无对应字段的）
     */
    private String agencyName;

    /**
     * 产品id
     */
    private String productId;
    /**
     * 推荐级别
     */
    private Integer grade;
    /**
     * 样本id
     */
    private String sampleType;

    /**
     * 样本名称
     */
    private String sampleTypeName;

    /**
     * 检测平台
     */
    private String detectionPlatform;
    /**
     * 检测平台字典值
     */
    private String detectionPlatformDesc;
    /**
     * 检测方法id
     */
    private String detectionMethod;
    /**
     * 检测方法字典值
     */
    private String detectionMethodDesc;

    /**
     * 检测周期
     */
    private String detectionPeriod;
    /**
     * 检测周围单位
     */
    private Integer  detectionPeriodUnit;
    /**
     * 检测周期描述
     */
    private String detectionPeriodDesc;
    /**
     * 机构套餐成本
     */
    private BigDecimal cost;
    /**
     * 耗材图片
     */
    @JsonSerialize(using = QiniuResourceSerializer.class)
    private String goodsImage;

    private BigDecimal productPrice;
    @JsonDeserialize(using = TimeJsonDeserializer.class)
    private Date createDateTime;
    @JsonDeserialize(using = TimeJsonDeserializer.class)
    private Date updateDateTime;
    private String description;
    private Integer deleteFlag;

    private String remarks;

    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }

    public String getGoodsImage() {
        return goodsImage;
    }

    public void setGoodsImage(String goodsImage) {
        this.goodsImage = goodsImage;
    }

    public String getDetectionPlatformDesc() {
        return detectionPlatformDesc;
    }

    public void setDetectionPlatformDesc(String detectionPlatformDesc) {
        this.detectionPlatformDesc = detectionPlatformDesc;
    }

    public String getDetectionMethodDesc() {
        return detectionMethodDesc;
    }

    public void setDetectionMethodDesc(String detectionMethodDesc) {
        this.detectionMethodDesc = detectionMethodDesc;
    }

    public String getSampleTypeName() {
        return sampleTypeName;
    }

    public void setSampleTypeName(String sampleTypeName) {
        this.sampleTypeName = sampleTypeName;
    }

    public String getId() {
        return id;
    }

    public String getAgencyName() {
        return agencyName;
    }

    public void setAgencyName(String agencyName) {
        this.agencyName = agencyName;
    }

    public void setId(String id) {
        this.id = id == null ? null : id.trim();
    }

    public String getAgencyId() {
        return agencyId;
    }

    public void setAgencyId(String agencyId) {
        this.agencyId = agencyId == null ? null : agencyId.trim();
    }

    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId == null ? null : productId.trim();
    }

    public Integer getGrade() {
        return grade;
    }

    public void setGrade(Integer grade) {
        this.grade = grade;
    }

    public String getSampleType() {
        return sampleType;
    }

    public void setSampleType(String sampleType) {
        this.sampleType = sampleType == null ? null : sampleType.trim();
    }

    public String getDetectionPlatform() {
        return detectionPlatform;
    }

    public void setDetectionPlatform(String detectionPlatform) {
        this.detectionPlatform = detectionPlatform == null ? null : detectionPlatform.trim();
    }

    public String getDetectionMethod() {
        return detectionMethod;
    }

    public void setDetectionMethod(String detectionMethod) {
        this.detectionMethod = detectionMethod == null ? null : detectionMethod.trim();
    }

    public String getDetectionPeriod() {
        return detectionPeriod;
    }

    public void setDetectionPeriod(String detectionPeriod) {
        this.detectionPeriod = detectionPeriod == null ? null : detectionPeriod.trim();
    }

    public BigDecimal getProductPrice() {
        return productPrice;
    }

    public void setProductPrice(BigDecimal productPrice) {
        this.productPrice = productPrice;
    }

    public Date getCreateDateTime() {
        return createDateTime;
    }

    public void setCreateDateTime(Date createDateTime) {
        this.createDateTime = createDateTime;
    }

    public Date getUpdateDateTime() {
        return updateDateTime;
    }

    public void setUpdateDateTime(Date updateDateTime) {
        this.updateDateTime = updateDateTime;
    }

    public Integer getDeleteFlag() {
        return deleteFlag;
    }

    public void setDeleteFlag(Integer deleteFlag) {
        this.deleteFlag = deleteFlag;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks == null ? null : remarks.trim();
    }

    /**
     * 字段校验
     */
    public void check(){
        FieldChecker.checkEmpty(this.sampleType, "样本类型不能为空");
        FieldChecker.checkEmpty(this.detectionPlatform, "样检测平台不能为空");
        FieldChecker.checkEmpty(this.agencyId, "样检测机构不能为空");
        FieldChecker.checkEmpty(this.detectionMethod, "检测方法不能为空");
        FieldChecker.checkEmpty(this.grade, "推荐级别不能为空");
        FieldChecker.checkEmpty(this.detectionPeriod, "周期不能为空");
    }

    public BigDecimal getCost() {
        return cost;
    }

    public void setCost(BigDecimal cost) {
        this.cost = cost;
    }

    public String getDetectionPeriodDesc() {
        return detectionPeriodDesc;
    }

    public void setDetectionPeriodDesc(String detectionPeriodDesc) {
        this.detectionPeriodDesc = detectionPeriodDesc;
    }

    public Integer getDetectionPeriodUnit() {
        return detectionPeriodUnit;
    }

    public void setDetectionPeriodUnit(Integer detectionPeriodUnit) {
        this.detectionPeriodUnit = detectionPeriodUnit;
    }
}